<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>产品</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<style>
		html{ padding: 10px}
	</style>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote">地标产品</blockquote>
<form class="layui-form" id="bd1">


	<div class="layui-form-item">
		<label class="layui-form-label">产品名称</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input newsName" lay-verify="name" value="{$t.title}" name="title" placeholder="">
		</div>
	</div>


	<div class="layui-form-item">



		

	</div>

	<div class="layui-form-item">


		 <label class="layui-form-label">选择</label>
		<div class="layui-input-inline" style="width: 300px">
				<select class="newsLook" name="ztname"  lay-search>

					<option value="{$t.ztname}">{$t.ztname}</option>

					{volist name="list" id="v"}
					
					<option>{$v.title}</option>
					

					{/volist}

				</select>
			</div>
		

	</div>
 

 <div class="layui-form-item">
		<label class="layui-form-label">产品价格</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input newsName" lay-verify="title" value="{$t.price}" name="price" placeholder="网址">
		</div>
	</div>

	<input type="hidden" id="picval" value="{$t.pic}" name="pic" />
	
	<div class="layui-form-item">
		<label class="layui-form-label">缩略图</label>
		<div class="layui-input-block">
			<button type="button" class="layui-btn layui-btn-danger" id="test7"><i class="layui-icon"></i>上传图片</button>
			<button type="button" class="layui-btn layui-btn-danger" onclick="yl()"><i class="layui-icon"></i>预览</button>
		</div>
	</div>


	<input type="hidden" name="tid" value="{:input('id')}" />
	
	
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button class="layui-btn" type="button"  lay-submit="" lay-filter="addNews" >立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>
{:jq()}
{:layui()}
{:ue()}
<script type="text/javascript">
var imgurl="{:config('cdn')}"+$("#picval").val();
function yl(){


parent.layer.open({
  type: 1,
  title: false,
  closeBtn: 0,
  area: '350px',
  skin: 'layui-layer-nobg', //没有背景色
  shadeClose: true,
  content: "<img src='"+imgurl+"' style='width:350px' />"
});



}


    layui.upload.render({
        elem: '#test7'
        ,url: "{:url('api/upload/ftp')}"
        ,size: 500000 //限制文件大小，单位 KB
        ,done: function(res){
        	layer.alert('上传成功');
            imgurl="{:config('cdn')}"+res.url;
            $("#picval").val(res.url);
        }
    });
  /*  var ue = UE.getEditor('news_content',{

        height:700
    });*/

    layui.form.on('submit(addNews)', function(data){
          
          $.post(' ',data.field,function(res){

                if(res.code==200){

                layer.alert('保存成功',function(){

                     
                     window.location.href="{:Url('splist')}";

                });

                }


          });

        console.log(JSON.stringify(data.field));
        return false;
    });


</script>
</body>
</html>